/**
 * 
 */
package com.nd.android.u.ui.activity.message_chat;

import android.annotation.TargetApi;
import android.os.Build;

import com.common.android.utils.ToastUtils;
import com.common.android.utils.task.genericTask.GenericTask;
import com.common.android.utils.task.genericTask.TaskResult;
import com.nd.android.u.ui.R;
import com.nd.android.u.ui.chatInterfaceImpl.DeleteChatRecordTask;


/**
 * 删除聊天记录监听
 * <br>Created 2014-12-19 下午6:57:45
 * @version  
 * @author   ChuXY		
 *
 * @see 	 
 */
public class DelChatRecordTaskListener extends com.common.android.utils.task.genericTask.TaskAdapter {
	
	private DeleteChatRecordTask mDeleteTask;
	@Override
	public void onPreExecute(GenericTask task) {
	}

	/**
	 * 实例化
	 * Creates a new instance of DelChatRecordTaskListener.
	 * <br>Created 2014-12-19 下午7:00:33
	 * @param task
	 */
	public DelChatRecordTaskListener(DeleteChatRecordTask task){
		mDeleteTask=task;
	}
	
	@TargetApi(Build.VERSION_CODES.CUPCAKE)
	@Override
	public void onPostExecute(GenericTask task, TaskResult result) {
		if (mDeleteTask != null && mDeleteTask.getStatus() == GenericTask.Status.RUNNING) {
			mDeleteTask.cancel(true);
		}
		if (result==TaskResult.FAILED){
			ToastUtils.display(R.string.delete_fail);
		}
	}
}
